package mysql.cs.packet;

import common.Util.ByteUtil;
import mysql.MysqlPacket;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * NULL is sent as 0xfb
 *
 * everything else is converted into a string and is sent as Protocol::LengthEncodedString.
 */
public class RowDataPacket extends MysqlPacket {
    private List<String> columns=new ArrayList<>();

    public void encode(byte[] data) throws IOException{
        int index=0;
        ByteUtil.LengthCodedStringReader stringReader=new ByteUtil().getNewLengthCodedStringReaderUTF8IDX0();
        do{
            getColumns().add(stringReader.readLengthCodedString(data));
        }while (stringReader.getIndex()<data.length);
    }
    //不可能
    public byte[] decode(){
        return null;
    }

    public List<String> getColumns() {
        return columns;
    }

    public void setColumns(List<String> columns) {
        this.columns = columns;
    }
}
